﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using System.Configuration;
using System.Net;
using System.Data;

namespace FONCREAGROINTEGRAL.Reporting.RRHH
{
    public partial class boletaPlanilla : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string IdEjercicioMes = Convert.ToString(Request.QueryString["IdEjercicioMes"]);
                string IdTipoTrabajador = Convert.ToString(Request.QueryString["IdTipoTrabajador"]);

                //int IdEjercicioMes = Convert.ToInt32(Request.QueryString["IdEjercicioMes"]);
                //int IdTipoTrabajador = Convert.ToInt32(Request.QueryString["IdTipoTrabajador"]);

                var reportServer = ConfigurationManager.AppSettings["ReportServer"].ToString();
                rptwboletaplanilla .ProcessingMode = ProcessingMode.Remote;
                rptwboletaplanilla.ServerReport.ReportServerUrl = new Uri(reportServer);
                rptwboletaplanilla.ServerReport.ReportPath = "/RRHH/Rpt/boletaPlanilla";
                //rptwboletaplanilla.ServerReport.ReportServerCredentials.NetworkCredentials
                
                NetworkCredential myCred = new NetworkCredential("UserName", "Password", "DomainName");

                rptwboletaplanilla.ShowPrintButton = true;
                rptwboletaplanilla.ShowParameterPrompts = false;
                ReportParameter[] param = new ReportParameter[2];
                param[0] = new ReportParameter("idejerciciomes", IdEjercicioMes);
                param[1] = new ReportParameter("IdTipoTrabajador", IdTipoTrabajador);
                rptwboletaplanilla.ServerReport.SetParameters(param);

                //rptwboletaplanilla.ServerReport.ReportServerCredentials.NetworkCredentials = myCred;

                rptwboletaplanilla.ServerReport.Refresh(); 
            }
        }
    }
}